package com.athbsd.exer3;



import org.junit.Test;

import java.util.*;

/**
 * Date:2025/2/23
 * Author：zhouzhou
 * Description:
 */
public class CollectionTest {
    @Test
    public void test() {
        Collection coll = new ArrayList();
        coll.add(1.0);
        coll.add("asd");
        coll.add("zhouzhou");
        coll.add(new Person("tom",19));
        coll.add(new Object());
        System.out.println(coll+"\t"+coll.size());
        Collection coll1 = new ArrayList();
        coll1.add(2.0);
        coll1.add("zxc");
        coll1.addAll(coll);
        System.out.println(coll1+"\t"+coll1.size());
        coll1.add(coll);
        System.out.println(coll1+"\t"+coll1.size());


        System.out.println(coll.isEmpty());
        System.out.println(coll.contains(new Person("tom", 19)));

    }
    @Test
    public void test2() {
    Collection coll = new ArrayList();
    coll.add(1.0);
    coll.add("asd");
    coll.add("zhouzhou");
    coll.add(new Person("tom",19));
            //集合--->数组
            Object[] array = coll.toArray();
            System.out.println(Arrays.toString(array));
            System.out.println(coll.hashCode());
}
        @Test
    public void test3() {
            //数组--->集合
            String[] arr=new String[]{"asd","zhouzhou"};
            List list1=Arrays.asList(1,2,3,4,5);

            System.out.println(list1);
            Collection list = Arrays.asList(arr);
            System.out.println(list);
    }
    @Test
    public void test4() {
        Integer[] arr=new Integer[]{1,2,3,4,5};
        List list1=Arrays.asList(1,2,3,4,5);
        System.out.println(list1);
        int[] arr1=new int[]{1,2,3,4,5};
        int[] arr2={1,2,3,4,5};
        System.out.println(arr1);
    }
}
